<?xml version="1.0" encoding="UTF-8" ?>
<%@ page
	contentType="text/html;charset=UTF-8"
	pageEncoding="UTF-8"
	import="fr.utbm.gi.in56.error.ErrorType" 
	import="fr.utbm.gi.in56.user.UserBean" 
%>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
        <link rel="stylesheet" media="screen" type="text/css" title="Style" href="style.css" />
        <title>L'Entre-Pot</title>
    </head>
    <body>
        <div id ="container">
            <jsp:directive.include file="header.jsp"/>
            <jsp:directive.include file="topMenu.jsp"/>
            <div id="core">
                <div id="frame">
					<% ErrorType error = (ErrorType)request.getAttribute( "editError" );%>
					<%
						if( error != null )
						{
					%>
							<div id="error">
							    <%= error.getErrorMessage() %>
							</div>
					<%
						}
					%>
                    <form method="post" action="EditServlet" name="editProfile">
                        <p class="center">
                            <label for="password">Mot de passe actuel :</label>
                            <input type="password" name="password" id="password" maxlength="20"/>
                        </p>
                        <p class="center">
                            <label for="newPassword1">Nouveau mot de passe :</label>
                            <input type="password" name="newPassword1" id="newPassword1" maxlength="20"/>
                        </p>
                        <p class="center">
                            <label for="newPassword2">Confimation :</label>
                            <input type="password" name="newPassword2" id="newPassword2" maxlength="20"/>
                        </p>
                        <p class="center">
                            <label for="county">Département :</label>
                            <select name="county" id="county">
                            
		                        <%
		                        	int userCounty = currentUser.getCounty();
		                        	for ( int county = 1; county <= 95; ++county )
		                        	{
		                        		if ( county < 10 )
		                        		{
		                        			if ( county == userCounty)
		                        			{
		                        				%>
		                        				<option selected="selected">0<%= userCounty %></option>
		                        				<%
		                        			}
		                        			else
		                        			{
               				 					%>
		                        				<option value="0<%= county %>">0<%= county %></option>
		                        				<%	
		                        			}
		                        		}
		                        		else
		                        		{
		                        			if ( county == userCounty )
		                        			{
		                        				%>
		                        				<option selected="selected"><%= userCounty %></option>
		                        				<%
		                        			}
		                        			else
		                        			{
               				 					%>
		                        				<option value="<%= county %>"><%= county %></option>
		                        				<%	
		                        			}	
		                        		}
		                        	}
		                        %>
							</select>
                        </p>
                        <p class="center">
                            <input type="submit" value="Appliquer les modifications" name="applyModif"/>
                        </p>
                    </form>
                </div>
            </div>
            
            <jsp:directive.include file="footer.jsp"/>
        </div>
    </body>
</html>
